﻿<%@ Page Language="C#" MasterPageFile="~/MasterPageSERIX.Master" AutoEventWireup="true"
    CodeBehind="MetasTecnicos.aspx.cs" Inherits="SERIX.MetasTecnicos" Title="Metas dos Técnicos" %>

<%@ Register Src="Controles/lovGenerica.ascx" TagName="lovGenerica" TagPrefix="uc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table width="97%" border="0" cellspacing="0" cellpadding="2" align="center">
        <tr>
            <td class="secao_titulo" style="width: 284px">
                Metas dos Técnicos<hr class="linhaHorizontal" style="width: 740px" />
            </td>
        </tr>
        <tr>
            <td align="left" class="erro">
                <asp:Label ID="lblErro" runat="server" CssClass="erro" Text="*Erro: " Visible="False"
                    Width="740px" TabIndex="-1" OnLoad="lblErro_Load"></asp:Label>
            </td>
        </tr>
    </table>
    <table align="center" border="0" cellpadding="2" cellspacing="0" width="97%">
        <tr>
            <td align="center" class="grid_titulo">
                <span style="color: #FFFFFF">Técnico: </span>
                <asp:TextBox ID="txtNomeTecnico" runat="server" Columns="40" MaxLength="60" Enabled="false"></asp:TextBox>
                <uc1:lovGenerica ID="lovTecnicos" runat="server" />
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtNomeTecnico"
                    CssClass="erro_pesquisa" ErrorMessage="*Campo obrigatório!" Display="Dynamic"
                    TabIndex="-1" Width="174px"></asp:RequiredFieldValidator>
                &nbsp;&nbsp;&nbsp;<span style="color: #FFFFFF">Município: </span>
                <asp:DropDownList ID="ddlMunicipios" runat="server" DataSourceID="SqlMunicipios"
                    DataTextField="NOME_MUN" DataValueField="IDT_MUN" AutoPostBack="True" 
                    onselectedindexchanged="ddlMunicipios_SelectedIndexChanged">
                </asp:DropDownList>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="ddlMunicipios"
                    CssClass="erro_pesquisa" ErrorMessage="*Campo obrigatório!" Display="Dynamic"
                    TabIndex="-1" Width="174px"></asp:RequiredFieldValidator>
                <asp:SqlDataSource ID="SqlMunicipios" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT  B.IDT_MUN, B.NOME_MUN FROM Serix.SRX_LOTACOES_TECNICOS A JOIN Serix.SRX_MUNICIPIOS B ON (A.IDT_TEC = :PARAM AND A.IDT_MUN = B.IDT_MUN AND A.STA_LOTACAO = 'A') ORDER BY NOME_MUN ">
                    <SelectParameters>
                        <asp:Parameter Name="PARAM" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td align="center" class="grid_titulo">
                <span style="color: #FFFFFF">Programa: </span>
                <asp:DropDownList ID="ddlProgramas" runat="server" AutoPostBack="True" DataSourceID="SqlProgramas"
                    DataTextField="NOM_PROG" DataValueField="IDT_PROG" OnSelectedIndexChanged="ddlProgramas_SelectedIndexChanged">
                </asp:DropDownList>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="ddlProgramas"
                    CssClass="erro_pesquisa" ErrorMessage="*Campo obrigatório!" Display="Dynamic"
                    TabIndex="-1" Width="174px"></asp:RequiredFieldValidator>
                <asp:SqlDataSource ID="SqlProgramas" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT P.IDT_PROG, P.NOM_PROG FROM SERIX.SRX_PROGRAMAS P 
      JOIN SERIX.SRX_PROGRAMAS_MUNICIPIOS PM ON (P.IDT_PROG = PM.IDT_PROG)
WHERE PM.IDT_MUN = :P_IDT_MUN
ORDER BY P.NOM_PROG">
                    <SelectParameters>
                        <asp:Parameter Name="P_IDT_MUN" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td align="center" class="grid_titulo">
                <span style="color: #FFFFFF">Ação: </span>
                <asp:DropDownList ID="ddlAcoes" runat="server" DataSourceID="SqlAcoesPrograma" DataTextField="DSC_ACAO"
                    DataValueField="IDT_ACAO" AutoPostBack="True" OnSelectedIndexChanged="ddlAcoes_SelectedIndexChanged">
                </asp:DropDownList>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="ddlAcoes"
                    CssClass="erro_pesquisa" ErrorMessage="*Campo obrigatório!" Display="Dynamic"
                    TabIndex="-1" Width="174px"></asp:RequiredFieldValidator>
                <asp:SqlDataSource ID="SqlAcoesPrograma" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT IDT_ACAO, DSC_ACAO FROM SERIX.SRX_ACOES_PROGRAMAS WHERE IDT_PROG = :PARAM ORDER BY DSC_ACAO">
                    <SelectParameters>
                        <asp:Parameter Name="PARAM" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td align="center" class="grid_titulo">
                <span style="color: #FFFFFF">Indicador: </span>
                <asp:DropDownList ID="ddlIndicadores" runat="server" DataSourceID="SqlIndicadoresAcao"
                    DataTextField="DSC_IND" DataValueField="IDT_IND">
                </asp:DropDownList>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ddlIndicadores"
                    CssClass="erro_pesquisa" ErrorMessage="*Campo obrigatório!" Display="Dynamic"
                    TabIndex="-1" Width="174px"></asp:RequiredFieldValidator>
                <asp:SqlDataSource ID="SqlIndicadoresAcao" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT IDT_IND, DSC_IND FROM Serix.SRX_INDICADORES_ACOES WHERE IDT_ACAO = :PARAM ORDER BY DSC_IND">
                    <SelectParameters>
                        <asp:Parameter Name="PARAM" />
                    </SelectParameters>
                </asp:SqlDataSource>
                &nbsp;&nbsp;&nbsp;<asp:Button ID="btnPequisar" runat="server" Font-Bold="True" OnClick="btnPequisar_Click"
                    TabIndex="5" Text="Pesquisar" Width="80px" />
                &#160;&#160;<asp:Button ID="btnLimpar" runat="server" CausesValidation="false" Font-Bold="True"
                    OnClick="btnLimpar_Click" TabIndex="6" Text="Limpar" UseSubmitBehavior="False"
                    Width="80px" />
            </td>
        </tr>
        <tr>
            <td align="left" style="color: #000000">
                <asp:Label ID="lblFiltro" runat="server" CssClass="filtro" TabIndex="-1" Text="Filtro: "></asp:Label>
            </td>
        </tr>
        <tr>
            <td align="center" style="color: #000000">
                <asp:GridView ID="gridView" runat="server" AutoGenerateColumns="False" CssClass="grid"
                    EmptyDataText="Nenhum registro encontrado." OnRowDataBound="gridView_RowDataBound">
                    <AlternatingRowStyle CssClass="row_alter" />
                    <Columns>
                        <asp:TemplateField Visible="False">
                            <ItemTemplate>
                                <asp:Label ID="lblIdtInd" runat="server" Text='<%# Bind("IDT_IND") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField Visible="False">
                            <ItemTemplate>
                                <asp:Label ID="lblIdtTpoMed" runat="server" Text='<%# Bind("IDT_TPO_MED") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField Visible="False">
                            <ItemTemplate>
                                <asp:Label ID="lblIdtLotacao" runat="server" Text='<%# Bind("IDT_LOTACAO") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField Visible="False">
                            <ItemTemplate>
                                <asp:Label ID="lblIdtDesc" runat="server" Text='<%# Bind("IDT_DESC") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="TIT_DESCRICAO" HeaderText="Tipo" ItemStyle-Width="320px">
                            <ItemStyle Width="320px"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="DESCRICAO" HeaderText="Descrição" ItemStyle-Width="620px">
                            <ItemStyle Width="620px"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="UNIDADE" HeaderText="Unidade" ItemStyle-Width="150px">
                            <ItemStyle Width="150px" HorizontalAlign="Center"></ItemStyle>
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="Meta">
                            <ItemTemplate>
                                <asp:TextBox ID="txtMeta" runat="server" Columns="12" MaxLength="12" Text="<%# Bind('Meta') %>"></asp:TextBox>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField FooterText="Excluir" HeaderText="Excluir" 
                            ItemStyle-Width="70px" Visible="False">
                            <ItemTemplate>
                                <asp:ImageButton ID="imbExcluirMeta" runat="server" CausesValidation="False" ImageUrl="Imagens/botoes/Delete.png"
                                    OnClick="imbExcluirMeta_Click" />
                                <cc1:ConfirmButtonExtender ID="imbExcluirMeta_ConfirmButtonExtender" runat="server"
                                    ConfirmText="Confirma a exclusão da meta?" Enabled="True" TargetControlID="imbExcluirMeta">
                                </cc1:ConfirmButtonExtender>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataRowStyle CssClass="emptyrow" />
                    <FooterStyle CssClass="footer" />
                    <HeaderStyle CssClass="header" />
                    <PagerStyle CssClass="pager" />
                    <RowStyle CssClass="row" />
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td style="height: 30px; color: black;" width="100%" align="center">
                <asp:Button ID="Ok_Button" runat="server" Font-Bold="True" Text="Ok" Width="80px"
                    OnClick="Ok_Button_Click" />
                &nbsp;<asp:Button ID="Cancelar_Button" runat="server" Font-Bold="True" OnClick="Cancelar_Button_Click"
                    Text="Cancelar" Width="80px" CausesValidation="False" />
            </td>
        </tr>
    </table>
</asp:Content>
